<template>
  <!-- 传参是否是注册 -->
<UserForm isRegister @onSubmit="onSubmit"/>
</template>

<script>
import { registerAPI } from '@/api/user'
import UserForm from '@/components/UserForm.vue'

export default {
  name: 'Register-Page',
  data () {
    return {
      username: '',
      password: ''
    }
  },
  components: {
    UserForm
  },
  methods: {
    async onSubmit (values) {
      // {username: this.username,
      // password: this.password}
      await registerAPI(values)
      this.$toast('注册成功')
      this.$router.push('/login')
    }
  }
}
</script>

<style lang="less" scoped>
  .link {
    color: #069;
    font-size: 12px;
    padding-right: 20px;
    float: right;
  }
</style>
